
<script>

  $(document).ready(function() {

    $('#calendar').fullCalendar({
      editable: true,
      eventLimit: true, // allow "more" link when too many events
      events: [
        <?php
          foreach ($hasil as $val) {
        ?>
        {
          title: '<?php echo $val['asal_peserta'] ?>',
          start: '<?php echo $val['tgl_mulai'] ?>',
          end: '<?php echo $val['tgl_selesai'] ?>',
          <?php
          if($val['id_divisi'] == 1){
          ?>
          backgroundColor: '#2F7ED8',
          borderColor: '#2F7ED8'
          <?php
          }else if($val['id_divisi'] == 2){
          ?>
          backgroundColor: '#0D233A',
          borderColor: '#0D233A'
          <?php
          }else{
          ?>
          backgroundColor: '#8BBC21',
          borderColor: '#8BBC21'
          <?php
          }
          ?>
        },
        <?php
          }
        ?>
      ]
    });
    
  });

</script>  
<style>
  #calendar {
    max-width: 900px;
    margin: 0 auto;
  }
</style>

    <div class="container margin-top-content">
      <div class="row">
        <div class="col-md-10 col-md-offset-1">
          <div class="col-md-12">
            <div class="row outer-border shadow singlepage">
              
              <div class="col-md-12 padding15">
                <h4 class="font-biru judul-singlepage">Informasi Magang</h4>
                <div id='calendar'></div>
                <h5>Divisi :</h5>
                <div style="padding-bottom: 5px;">
                  <span style="background: #2F7ED8;">&nbsp; &nbsp; &nbsp;</span> Software and Development<br>
                </div>
                <div style="margin-bottom: 5px;">
                  <span style="background: #0D233A;">&nbsp; &nbsp; &nbsp;</span> Infrastruktur<br>
                </div>
                <div>
                  <span style="background: #8BBC21;">&nbsp; &nbsp; &nbsp;</span> Internet Service Provider<br>
                </div>
                <br>
                <!-- 
                <div class="table-responsive small">
                  <table class="table table-bordered">
                    <thead>
                      <tr>
                        <th></th>
                        <?php 
                          $tahun = date("Y");
                          $jml1 = jumlah_minggu("01-01-$tahun","31-01-$tahun");
                        ?>
                        <th colspan="<?php echo $jml1; ?>">Januari</th>
                        <?php
                          if($tahun%4 == 0) {
                            $jml2 = jumlah_minggu("01-02-$tahun","29-02-$tahun"); 
                          }else{
                            $jml2 = jumlah_minggu("01-02-$tahun","28-02-$tahun");
                          }
                        ?>
                        <th colspan="<?php echo $jml2; ?>">Februari</th>
                        <?php $jml3 = jumlah_minggu("01-03-$tahun","31-03-$tahun"); ?>
                        <th colspan="<?php echo $jml3; ?>">Maret</th>
                        <?php $jml4 = jumlah_minggu("01-04-$tahun","30-04-$tahun"); ?>
                        <th colspan="<?php echo $jml4; ?>">April</th>
                        <?php $jml5 = jumlah_minggu("01-05-$tahun","31-05-$tahun"); ?>
                        <th colspan="<?php echo $jml5; ?>">Mei</th>
                        <?php $jml6 = jumlah_minggu("01-06-$tahun","30-06-$tahun"); ?>
                        <th colspan="<?php echo $jml6; ?>">Juni</th>
                        <?php $total1 = $jml1 + $jml2 + $jml3 + $jml4 + $jml5 + $jml6; ?>
                      </tr>
                      <tr>
                        <th></th>
                        <?php
                          for($i=1;$i<=$jml1;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml2;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml3;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml4;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml5;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml6;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                        ?>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td>ISP</td>
                        <?php
                          $hari1 = 1;
                          $hari2 = 7;
                          for($i=1;$i<=$total1;$i++){
                            $date1 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari1))."<br>";
                            $date2 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari2))."<br>";
                            echo cek_magang($date1,$date2,1);
                          }
                        ?>
                      </tr>
                      <tr>
                        <td>Infrastruktur</td>
                        <?php
                          for($i=1;$i<=$total1;$i++){
                            $date1 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari1))."<br>";
                            $date2 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari2))."<br>";
                            echo cek_magang($date1,$date2,2);
                          }
                        ?>
                      </tr>
                      <tr>
                        <td>Softdev</td>
                        <?php
                          for($i=1;$i<=$total1;$i++){
                            $date1 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari1))."<br>";
                            $date2 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari2))."<br>";
                            echo cek_magang($date1,$date2,3);
                          }
                        ?>
                      </tr>
                    </tbody>
                  </table>
                  <br>

                  <table class="table table-bordered">
                    <thead>
                      <tr>
                        <th></th>
                        <?php $jml7 = jumlah_minggu("01-07-$tahun","31-07-$tahun"); ?>
                        <th colspan="<?php echo $jml7; ?>">Juli</th>
                        <?php $jml8 = jumlah_minggu("01-08-$tahun","31-08-$tahun"); ?>
                        <th colspan="<?php echo $jml8; ?>">Agustus</th>
                        <?php $jml9 = jumlah_minggu("01-09-$tahun","30-09-$tahun"); ?>
                        <th colspan="<?php echo $jml9; ?>">September</th>
                        <?php $jml10 = jumlah_minggu("01-10-$tahun","31-10-$tahun"); ?>
                        <th colspan="<?php echo $jml10; ?>">Oktober</th>
                        <?php $jml11 = jumlah_minggu("01-11-$tahun","30-11-$tahun"); ?>
                        <th colspan="<?php echo $jml11; ?>">November</th>
                        <?php $jml12 = jumlah_minggu("01-12-$tahun","31-12-$tahun"); ?>
                        <th colspan="<?php echo $jml12; ?>">Desember</th>
                        <?php $total2 = $jml7 + $jml8 + $jml9 + $jml10 + $jml11 + $jml12; ?>
                      </tr>
                      <tr>
                        <th></th>
                        <?php
                          for($i=1;$i<=$jml7;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml8;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml9;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml10;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml11;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                          for($i=1;$i<=$jml12;$i++){
                            echo "<th>".romawi($i)."</th>";
                          }
                        ?>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td>ISP</td>
                        <?php
                          $mulai = $total1 + 1;
                          $selesai = $total1 + $total2;
                          for($i=$mulai;$i<=$selesai;$i++){
                            $date1 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari1))."<br>";
                            $date2 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari2))."<br>";
                            echo cek_magang($date1,$date2,1);
                          }
                        ?>
                      </tr>
                      <tr>
                        <td>Infrastruktur</td>
                        <?php
                          for($i=$mulai;$i<=$selesai;$i++){
                            $date1 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari1))."<br>";
                            $date2 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari2))."<br>";
                            echo cek_magang($date1,$date2,2);
                          }
                        ?>
                      </tr>
                      <tr>
                        <td>Softdev</td>
                        <?php
                          for($i=$mulai;$i<=$selesai;$i++){
                            $date1 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari1))."<br>";
                            $date2 = date('Y-m-d', strtotime($tahun."W".str_pad($i,2,'0',STR_PAD_LEFT).$hari2))."<br>";
                            echo cek_magang($date1,$date2,3);
                          }
                        ?>
                      </tr>
                    </tbody>
                  </table>
                </div>-->
                <center>
                  <a href="<?php echo site_url('pendaftaran-magang'); ?>">
                    <button class="btn btn-primary btn-sm">Daftar Magang</button>
                  </a>
                </center>
              </div>
            <div class="clearfix"></div>
            </div>
          </div>
        <div class="clearfix"></div>
        </div>
      </div>
    </div><!-- /.container -->